const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    entry: './src/index.js',
    context: process.cwd(),
    mode: 'development',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'monitor.js'
    },
    devServer: {
        static: path.resolve(__dirname, 'dist'),
        proxy: {
            open: true,
            '/api': {
                target: 'http://pv.sohu.com/',
                changeOrigin: true,
                pathRewrite: {
                '/api': '/'
                }
            }
        }
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
            inject: 'head',
            scriptLoading: 'blocking'
        })
    ]
}